<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <title>University Management System</title>
</head>

<body>
    <!-- 导航栏 -->
    <nav>
        <ul>
            <li><a href="course_management.html">Course Management</a></li>
            <li><a href="library_management.html">Library Management</a></li>
            <li><a href="social_life.html">Social Life</a></li>
            <li><a href="data_display.html">Data Display</a></li>
        </ul>
    </nav>
    <!-- 内容容器 -->
    <div class="container">
        <h1>Welcome to the University Management System</h1>
        <p class="text-center text-gray-600">Group name: Just way</p>
        <p class="text-center text-gray-600">Creator: Serein Yori Shane</p>
        <p class="introduction text-center text-gray-700 mt-4">
            This is an introduction to the University Management System. It provides a comprehensive
            platform for managing courses, library resources, and social life within the university. You can easily
            add students, manage courses, borrow books, and interact with other students through this system.
        </p>
        <div class="flex justify-center mt-8">
            <input type="text" id="homeInput" placeholder="Enter feedback" class="border border-gray-300 p-2 rounded-l-md w-64">
            <button id="homeFeedbackButton" class="bg-blue-600 text-white p-2 rounded-r-md hover:bg-blue-700">Leave Feedback</button>
        </div>
        <div class="feedback-window text-center text-gray-700 mt-4" id="homeFeedback"></div>
    </div>
    <script>
        document.getElementById('homeFeedbackButton').addEventListener('click', function () {
            const input = document.getElementById('homeInput').value;
            const feedbackDiv = document.getElementById('homeFeedback');
            feedbackDiv.textContent = `You entered: ${input}`;
        });

        const filePaths = [
            'books.json',
            'classes.json',
            'courses.json',
            'grades.json',
            'students.json'
        ];

        const allData = {};

        async function loadAllJSONFiles() {
                let allData = {};
                // 这里是获取数据并填充 allData 的逻辑
                try {
                const filePaths = [
                     'books.json',
                     'classes.json',
                     'courses.json',
                     'grades.json',
                     'students.json'
                ];
                const promises = filePaths.map(async (filePath) => {
                    const response = await fetch(filePath);
                    if (!response.ok) {
                       throw new Error(`Failed to load ${filePath}: ${response.status} ${response.statusText}`);
                   }
                   const data = await response.json();
                   const fileName = filePath.split('.')[0];
                   allData[fileName] = data;
               });
               await Promise.all(promises);
               console.log('All JSON files loaded successfully:', allData);
               localStorage.setItem('allData', JSON.stringify(allData));
               return allData; // 添加返回值，以便外部获取
         } catch (error) {
             console.error('Error loading JSON files:', error);
         }
         return allData; // 确保函数正常结束时也有返回
}

// 调用函数并接收返回值
const receivedAllData = loadAllJSONFiles();
// 后续使用 receivedAllData 进行操作
    </script>
</body>

</html>
    
    